﻿using System;
using System.IO;
using System.Reflection;
using System.Web;
using AnyOffice.Components;
using log4net;
namespace AnyOffice.general.qikan
{
    public partial class show_photo : System.Web.UI.Page
    {
        private static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        protected void Page_Load(object sender, EventArgs e)
        {

            try
            {
                Response.Buffer = true;
                Response.Clear();
                QikanInfo qikanInfo = QikanFactory.GetQikanInfo();
                if (qikanInfo != null)
                {
                    string str = (Request.QueryString["filename"] != null) ? Request.QueryString["filename"].ToString() : "";
                    str = str.Replace("../", "").Replace("/", @"\");
                    FileInfo info2 = new FileInfo(qikanInfo.DiskPath + str);
                    if (info2.Exists)
                    {
                        Response.ContentType = "image/jpeg";
                        Response.WriteFile(info2.FullName);
                    }
                }
            }
            catch (Exception exception)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("", exception);
                }
            }
        }
    }
}
